import React from "react";
// const { Consumer } = createContext();
import { Consumer } from "./App";

const Child2 = () => {
  return (
    <div>
      child2组件 -{" "}
      {/* Consumer组件中间要写一个函数, 可以接收一个value属性，返回一个jsx */}
      <Consumer>
        {({ name, age }) => (
          <span>
            {name} - {age}
          </span>
        )}
      </Consumer>
    </div>
  );
};

export default Child2;
